function search( key : typekey; var r : dataarray ) : integer;
var i, last : integer;
begin
i := hashfunction( key ) ;
last := (i+n-1) mod m;
while (i<>last) and (not empty(r[i])) and (r[i].k<>key) do
i := (i+1) mod m;
if r[i].k=key then search := i {*** found(r[i]) ***}
else search := -1; {*** notfound(key) ***}
end;
|